package com.sgai.zero_robot.ui.select_file_config;


import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import com.sgai.zero_robot.base.BaseAdapter;
import com.sgai.zero_robot.databinding.ItemSelectCityLineBinding;

public class SelectFileListAdapter extends BaseAdapter<TowerDetail, ItemSelectCityLineBinding> {
    private final Context context;
    private int currentIndex = -1;

    public int getCurrentIndex() {
        return currentIndex;
    }

    public void setCurrentIndex(int currentIndex) {
        this.currentIndex = currentIndex;
    }

    public SelectFileListAdapter(Context context) {
        super();
        this.context = context;
    }
    @Override
    protected void onBindView(ItemSelectCityLineBinding binding, int position, TowerDetail info) {
        if (position == currentIndex){
            binding.getRoot().setBackgroundColor(Color.WHITE);
        }else{
            binding.getRoot().setBackgroundColor(Color.TRANSPARENT);
        }
        if (!TextUtils.isEmpty(info.getProvince())){
            binding.tvProvince.setText(info.getProvince());
        }
        if (!TextUtils.isEmpty(info.getCity())){
            binding.tvCity.setText(info.getCity());
        }
        if (!TextUtils.isEmpty(info.getLineName())){
            binding.tvLineName.setText(info.getLineName());
        }
        binding.tvTowerNum.setText("#"+info.getTowerNum());
    }
}